<template>
  <div class="papers">
    <el-table :data="tableData" class="table">
      <el-table-column prop="id" label="序号" width="100%"/>
      <el-table-column prop="name" label="名称" width="130%"/>
      <el-table-column prop="date" label="时间"/>
      <el-table-column fixed="right" label="操作" width="60%">
        <template slot-scope="scope">
          <el-button @click.native.prevent="deleteRow(scope.$index, tableData)" type="text" size="small">查看</el-button>
        </template>
      </el-table-column>
    </el-table>
    <div class="page">
      <el-pagination :page-size="20" :pager-count="11" layout="prev, pager, next" :total="1000" class="page-item"/>
    </div>
  </div>
</template>

<script>

  import papers from "../../utils/papers"

  export default {
    name: "papers",
    data() {
      return {
        tableData: []
      }
    },
    methods: {
      deleteRow(index, rows) {
        rows.splice(index, 1);
      },
      getPaper() {
        console.log(papers.tableData);
        this.tableData = [...papers.tableData]
      },
    },
    created() {
      this.getPaper()
    }
  }
</script>

<style scoped>
  .table {
    width: 100%;
  }

  .papers {
    width: 100%;
  }

  .page {
    margin-top: 2%;
  }
</style>
